package com.gack.business.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.gack.business.dao.OrderDao;
import com.gack.helper.common.AjaxJson;
import com.gack.helper.common.abstractobj.ApiController;

import io.swagger.annotations.ApiOperation;

@RestController
@RequestMapping(ApiController.ORDER_QUERY)
public class OrderController {

	@Autowired
	private OrderDao orderDao;

	/**
	 * 
	 * @Title: indexStatistical
	 * @Description: 查询所有订单信息
	 * @param status 0全部-1使用中-2已完成-3已取消-4预约中-5待支付 
	 * @param time 0 全部 1今天 2本周 3本月 4本季度
	 * @param page 页数 (0开始)
	 * @param pageSize 页面展示数据数 
	 * @return AjaxJson 
	 * @throws
	 */
	@ApiOperation("查询所有订单信息")
	@PostMapping
	public AjaxJson indexStatistical(String status, String time, int page, int pageSize) {
		AjaxJson ajaxJson = new AjaxJson();
		try {
			ajaxJson.setSuccess(true).setStatus(200).setData(orderDao.findAllOrder(status, "0", time, 0, page, pageSize));
		} catch (Exception e) {
			e.printStackTrace();
		}
		return ajaxJson;
	}

}
